package cn.ylz.ylmall.content.dao.persist.repository.impl;

import cn.ylz.ylmall.content.dao.persist.mapper.LikeMapper;
import cn.ylz.ylmall.content.dao.persist.repository.ILikeRepository;
import cn.ylz.ylmall.content.pojo.entity.Like;
import cn.ylz.ylmall.content.pojo.vo.CountVO;
import cn.ylz.ylmall.content.pojo.vo.LikeStandardVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Slf4j
@Repository
public class LikeRepositoryImpl implements ILikeRepository {
    @Autowired
    private LikeMapper likeMapper;
    @Override
    public int insert(Like like) {
        log.debug("开始插入数据 参数{}",like);
        return likeMapper.insert(like);
    }

    @Override
    public LikeStandardVO selectIsLike(Long userId, Long contentId) {
        System.out.println("userId="+userId);
        System.out.println("contentId="+contentId);
        return likeMapper.selectIsLike(userId,contentId);

    }

    @Override
    public int delete(Long userId, Long contentId) {
        return likeMapper.deleteLike(userId,contentId);
    }

    @Override
    public CountVO count(Long contentId) {
        return likeMapper.countLike(contentId);
    }


}
